package com.donfu.system.service.house.impl;

import java.util.Date;
import java.util.List;

import com.donfu.system.domain.house.HouseStoreJoin;
import com.donfu.system.mapper.house.HouseStoreJoinMapper;
import com.donfu.system.service.house.IHouseStoreJoinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 店铺加盟Service业务层处理
 * 
 * @author donfu
 * @date 2021-12-08
 */
@Service
public class HouseStoreJoinServiceImpl implements IHouseStoreJoinService
{
    @Autowired
    private HouseStoreJoinMapper houseStoreJoinMapper;

    /**
     * 查询店铺加盟
     * 
     * @param id 店铺加盟主键
     * @return 店铺加盟
     */
    @Override
    public HouseStoreJoin selectHouseStoreJoinById(Long id)
    {
        return houseStoreJoinMapper.selectHouseStoreJoinById(id);
    }

    /**
     * 查询店铺加盟列表
     * 
     * @param houseStoreJoin 店铺加盟
     * @return 店铺加盟
     */
    @Override
    public List<HouseStoreJoin> selectHouseStoreJoinList(HouseStoreJoin houseStoreJoin)
    {
        return houseStoreJoinMapper.selectHouseStoreJoinList(houseStoreJoin);
    }

    /**
     * 新增店铺加盟
     * 
     * @param houseStoreJoin 店铺加盟
     * @return 结果
     */
    @Override
    public int insertHouseStoreJoin(HouseStoreJoin houseStoreJoin)
    {
        houseStoreJoin.setCreateDate(new Date());
        // 是否通过审批，默认正在审批 0
        houseStoreJoin.setIsAllow(0);
        return houseStoreJoinMapper.insertHouseStoreJoin(houseStoreJoin);
    }

    /**
     * 修改店铺加盟
     * 
     * @param houseStoreJoin 店铺加盟
     * @return 结果
     */
    @Override
    public int updateHouseStoreJoin(HouseStoreJoin houseStoreJoin)
    {
        return houseStoreJoinMapper.updateHouseStoreJoin(houseStoreJoin);
    }

    /**
     * 批量删除店铺加盟
     * 
     * @param ids 需要删除的店铺加盟主键
     * @return 结果
     */
    @Override
    public int deleteHouseStoreJoinByIds(Long[] ids)
    {
        return houseStoreJoinMapper.deleteHouseStoreJoinByIds(ids);
    }

    /**
     * 删除店铺加盟信息
     * 
     * @param id 店铺加盟主键
     * @return 结果
     */
    @Override
    public int deleteHouseStoreJoinById(Long id)
    {
        return houseStoreJoinMapper.deleteHouseStoreJoinById(id);
    }

    @Override
    public int deleteHouseStoreJoinByIdAndUserId(Long id, Long userId) {
        return houseStoreJoinMapper.deleteHouseStoreJoinByIdAndUserId(id,userId);
    }
}
